import Event

class RssController {

  def feed = {
    def results = Event.list(max: 10, sort: "startDate", order: 'desc')
    render(contentType: 'application/rss+xml') {
      rss(version: '2.0') {
        channel {
          title('Recent Events')
          description('A feed of the 10 most recent events')
          link('/event/list')
          results.each {event ->
            item {
              title(event.name)
              description('Event Description: ' + event.description + '<br>Start Date: ' + event.startDate + '<br>End Date: ' + event.endDate )
              event
//              categories {startDate: event.startDate; endDate: event.endDate}
//              startDate(event.startDate)
//              endDate(event.endDate)
              link("/event/view/${event.id}")

            }
          }
        }
      }
    }
  }

}
